from django.conf.urls import url
from rest_framework_jwt.views import obtain_jwt_token

from . import views

urlpatterns = [
    # 用户名
    url(r'^usernames/(?P<username>\w{5,20})/count/$', views.RegisterUsernameCountView.as_view(), name='usernamecount'),
    # 手机号
    url(r'^phones/(?P<mobile>1[345789]\d{9})/count/$', views.RegisterPhoneCountAPIView.as_view(), name='phonecount'),
    # 注册
    url(r'^$', views.RegisterCreateUserView.as_view()),
    # 登陆
    # url(r'^auths/', obtain_jwt_token, name='auths'),
    url(r'^auths/', views.UserAuthorizationView.as_view()),

    # 用户中心
    url(r'^infos/$',views.UserCenterView.as_view()),
    # 邮件
    url(r'^emails/$',views.UserEmailView.as_view()),
    # 激活邮箱
    url(r'^emails/verification/$',views.UserActiveEmailView.as_view()),
    # 增加地址/显示所有地址
    url(r'^addresses/$',views.AddressCreateAPIView.as_view()),
    # 修改删除地址
    url(r'^addresses/(?P<pk>\d+)/$',views.AddressDestroyAPIView.as_view()),
    # 修改标题
    url(r'^addresses/(?P<pk>\d+)/title/$',views.UpdateAPIView.as_view()),
    # 设置默认地址
    url(r'^addresses/(?P<id>\d+)/status/$', views.AddressStatusAPIView.as_view()),
    # 添加浏览商品/显示用户的浏览商品
    url(r'^browerhistories/$',views.UserHistoryView.as_view(),name='history'),
]

